﻿using FirstFloor.ModernUI.Presentation;
using SelElectCalcModernUI.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SelElectCalcModernUI.ViewModel.Settings
{
    public class OtherSettingViewModel : NotifyPropertyChanged, IDisposable
    {
        double factoryBackRage = 75;
        double sellerBackRage = 25;
        /// <summary>
        /// 由于数据部分暂时没有独立出来，用这里的静态方法创建实体
        /// </summary>
        /// <returns></returns>
        public static OtherSettingViewModel CreateOtherSettingViewModel()
        {
            var data = SaveLoadData.LoadOtherSettingData<OtherSettingViewModel>();
            return data;
        }
        /// <summary>
        /// 电厂的返还系数
        /// </summary>
        public double FactoryBackRage
        {
            get
            {
                return factoryBackRage;
            }

            set
            {
                factoryBackRage = value;
                OnPropertyChanged("FactoryBackRage");
            }
        }
        /// <summary>
        /// 电商的返还系数
        /// </summary>
        public double SellerBackRage
        {
            get
            {
                return sellerBackRage;
            }

            set
            {
                sellerBackRage = value;
                OnPropertyChanged("SellerBackRage");
            }
        }
        
        public void Dispose()
        {
            SaveLoadData.SaveOtherSettingData<OtherSettingViewModel>(this);
        }
    }
}
